package Q3;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    public static int n;
    public static int k;

    public static int[] happy;
    public static int[] shame;

    public static int ret;
    public static int day;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        n = scanner.nextInt();
        k = scanner.nextInt(); //吃下桃子后，持续 k 天

        shame = new int[n]; //羞耻度
        happy = new int[n]; //快乐值

        for (int i = 0; i < n; i++) {
            happy[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            shame[i] = scanner.nextInt();
        }

        Deque<Integer> queue = new LinkedList<>(); //双端队列

        dfs(0, 0, queue);

        System.out.println(day);

    }

    public static void dfs(int index, int retFeel, Deque<Integer> queue) {
        if (queue.size() == k) {
            if (retFeel > ret) {
                day = index - k + 1;
            }

            retFeel -= queue.poll();
        }

        if (index == n) {
            return;
        }

        for (int i = index; i < n; i++) {
            //选
            queue.offer(happy[i] - shame[i]);
            dfs(i + 1, retFeel + (happy[i] - shame[i]), queue);
            //回溯
            queue.pollLast();

            //不选
            dfs(i + 1, retFeel, queue);
        }
    }
}
